<div class="content-section introduction">
    <div class="feature-intro">
        <h1>Slide Menu</h1>
        <p>SlideMenu displays submenus with slide animation.</p>
    </div>
</div>

<div class="content-section implementation">
    <div class="card">
        <h5>Basic</h5>
        <p-slideMenu [model]="items" [viewportHeight]="250" [menuWidth]="175"></p-slideMenu>

        <h5>Popup</h5>
        <button #btn type="button" pButton icon="pi pi-bars" label="Show" (click)="menu.toggle($event)"></button>
        <p-slideMenu #menu [model]="items" [popup]="true" [viewportHeight]="250" [menuWidth]="175"></p-slideMenu>
    </div>

</div>

<div class="content-section documentation">
    <p-tabView>
        <p-tabPanel header="Documentation">
            <h5>Import</h5>
<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
import &#123;SlideMenuModule&#125; from 'primeng/slidemenu';
import &#123;MenuItem&#125; from 'primeng/api';
</app-code>

            <h5>MenuModel API</h5>
            <p>SlideMenu uses the common menumodel api to define its items, visit <a [routerLink]="['/menumodel']">MenuModel API</a> for details.</p>

            <h5>Getting Started</h5>
            <p>SlideMenu requires nested menuitems as its <i>model</i>.</p>
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;p-slideMenu [model]="items"&gt;&lt;/p-slideMenu&gt;
</app-code>

<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
export class SlideMenuDemo &#123;

    items: MenuItem[];

    ngOnInit() &#123;
        this.items = [
            &#123;
                label: 'File',
                items: [&#123;
                        label: 'New', 
                        icon: 'pi pi-fw pi-plus',
                        items: [
                            &#123;label: 'Project'&#125;,
                            &#123;label: 'Other'&#125;,
                        ]
                    &#125;,
                    &#123;label: 'Open'&#125;,
                    &#123;label: 'Quit'&#125;
                ]
            &#125;,
            &#123;
                label: 'Edit',
                icon: 'pi pi-fw pi-pencil',
                items: [
                    &#123;label: 'Delete', icon: 'pi pi-fw pi-trash'&#125;,
                    &#123;label: 'Refresh', icon: 'pi pi-fw pi-refresh'&#125;
                ]
            &#125;
        ];
    &#125;
&#125;
</app-code>

            <h5>Popup Mode</h5>
            <p>SlideMenu is inline by default, popup mode is also supported by enabling popup property and calling toggle method by passing the event 
                    from the anchor element.</p>
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;p-slideMenu #menu [model]="items" [popup]="true"&gt;&lt;/p-slideMenu&gt;
&lt;button #btn type="button" pButton icon="pi pi-list" label="Show" (click)="menu.toggle($event)"&gt;&lt;/button&gt;
</app-code>

            <h5>Effects</h5>
            <p>The easing function to use is "ease-out" by default and this can be customized using easing property. 
                See <a href="http://www.w3schools.com/cssref/css3_pr_transition-timing-function.asp">here</a> for possible alternative values.</p>
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;p-slideMenu #menu [model]="items" effectDuration="1000" easing="ease-in"&gt;&lt;/p-slideMenu&gt;
</app-code>

            <h5>Animation Configuration</h5>
            <p>Transition of the open and hide animations can be customized using the showTransitionOptions and hideTransitionOptions properties, 
                example below disables the animations altogether.</p>
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;p-slideMenu [showTransitionOptions]="'0ms'" [hideTransitionOptions]="'0ms'" #menu [model]="items" [popup]="true"&gt;&lt;/p-slideMenu&gt;
&lt;button #btn type="button" pButton icon="pi pi-list" label="Show" (click)="menu.toggle($event)"&gt;&lt;/button&gt;
</app-code>

            <h5>Properties</h5>
            <div class="doc-tablewrapper">
                <table class="doc-table">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Type</th>
                            <th>Default</th>
                            <th>Description</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>model</td>
                            <td>array</td>
                            <td>null</td>
                            <td>An array of menuitems.</td>
                        </tr>
                        <tr>
                            <td>popup</td>
                            <td>boolean</td>
                            <td>false</td>
                            <td>Defines if menu would displayed as a popup.</td>
                        </tr>
                        <tr>
                            <td>style</td>
                            <td>string</td>
                            <td>null</td>
                            <td>Inline style of the component.</td>
                        </tr>
                        <tr>
                            <td>styleClass</td>
                            <td>string</td>
                            <td>null</td>
                            <td>Style class of the component.</td>
                        </tr>
                        <tr>
                            <td>easing</td>
                            <td>string</td>
                            <td>ease-out</td>
                            <td>Easing animation to use for sliding.</td>
                        </tr>
                        <tr>
                            <td>effectDuration</td>
                            <td>any</td>
                            <td>250</td>
                            <td>Duration of the sliding animation in milliseconds.</td>
                        </tr>
                        <tr>
                            <td>backLabel</td>
                            <td>string</td>
                            <td>Back</td>
                            <td>Label of element to navigate back.</td>
                        </tr>
                        <tr>
                            <td>menuWidth</td>
                            <td>number</td>
                            <td>180</td>
                            <td>Width of the submenus.</td>
                        </tr>
                        <tr>
                            <td>viewportHeight</td>
                            <td>number</td>
                            <td>175</td>
                            <td>Height of the scrollable area, a scrollbar appears if a menu height is longer than this value.</td>
                        </tr>
                        <tr>
                            <td>appendTo</td>
                            <td>any</td>
                            <td>null</td>
                            <td>Target element to attach the overlay, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name).</td>
                        </tr>
                        <tr>
                            <td>baseZIndex</td>
                            <td>number</td>
                            <td>0</td>
                            <td>Base zIndex value to use in layering.</td>
                        </tr>
                        <tr>
                            <td>autoZIndex</td>
                            <td>boolean</td>
                            <td>true</td>
                            <td>Whether to automatically manage layering.</td>
                        </tr>
                        <tr>
                            <td>showTransitionOptions</td>
                            <td>string</td>
                            <td>.12s cubic-bezier(0, 0, 0.2, 1)</td>
                            <td>Transition options of the show animation.</td>
                        </tr>
                        <tr>
                            <td>hideTransitionOptions</td>
                            <td>string</td>
                            <td>.1s linear</td>
                            <td>Transition options of the hide animation.</td>
                        </tr>
                    </tbody>
                </table>
            </div>
            
            <h5>Methods</h5>
            <div class="doc-tablewrapper">
                <table class="doc-table">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Parameters</th>
                            <th>Description</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>toggle</td>
                            <td>event: browser event</td>
                            <td>Toggles the visibility of the popup menu.</td>
                        </tr>
                        <tr>
                            <td>show</td>
                            <td>event: browser event</td>
                            <td>Displays the popup menu.</td>
                        </tr>
                        <tr>
                            <td>hide</td>
                            <td>-</td>
                            <td>Hides the popup menu.</td>
                        </tr>
                    </tbody>
                </table>
            </div>

            <h5>Styling</h5>
            <p>Following is the list of structural style classes, for theming classes visit <a href="#" [routerLink]="['/theming']">theming page</a>.</p>
            <div class="doc-tablewrapper">
                <table class="doc-table">
                    <thead>
                    <tr>
                        <th>Name</th>
                        <th>Element</th>
                    </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>p-slidemenu</td>
                            <td>Container element.</td>
                        </tr>
                        <tr>
                            <td>p-slidemenu-wrapper</td>
                            <td>Wrapper of content.</td>
                        </tr>
                        <tr>
                            <td>p-slidemenu-content</td>
                            <td>Content element.</td>
                        </tr>
                        <tr>
                            <td>p-slidemenu-backward</td>
                            <td>Element to navigate to previous menu on click.</td>
                        </tr>
                        <tr>
                            <td>p-menu-list</td>
                            <td>List element.</td>
                        </tr>
                        <tr>
                            <td>p-menuitem</td>
                            <td>Menuitem element.</td>
                        </tr>
                        <tr>
                            <td>p-menuitem-text</td>
                            <td>Label of a menuitem.</td>
                        </tr>
                        <tr>
                            <td>p-menuitem-icon</td>
                            <td>Icon of a menuitem.</td>
                        </tr>
                        <tr>
                            <td>p-submenu-icon</td>
                            <td>Arrow icon of a submenu.</td>
                        </tr>
                    </tbody>
                </table>
            </div>

            <h5>Dependencies</h5>
            <p>None.</p>
        </p-tabPanel>

        <p-tabPanel header="Source">
            <a href="https://github.com/primefaces/primeng/tree/master/src/app/showcase/components/slidemenu" class="btn-viewsource" target="_blank">
                <span>View on GitHub</span>
            </a>
            <a href="https://stackblitz.com/edit/primeng-slidemenu-demo" class="btn-viewsource" style="margin-left: .5em;" target="_blank">
                <span>Edit in StackBlitz</span>
            </a>
<app-code lang="markup" ngNonBindable ngPreserveWhitespaces>
&lt;h5&gt;Basic&lt;/h5&gt;
&lt;p-slideMenu [model]="items" [viewportHeight]="250"&gt;&lt;/p-slideMenu&gt;

&lt;h5&gt;Popup&lt;/h5&gt;
&lt;button #btn type="button" pButton icon="pi pi-bars" label="Show" (click)="menu.toggle($event)"&gt;&lt;/button&gt;
&lt;p-slideMenu #menu [model]="items" [popup]="true" [viewportHeight]="250"&gt;&lt;/p-slideMenu&gt;
</app-code>

<app-code lang="typescript" ngNonBindable ngPreserveWhitespaces>
export class SlideMenuDemo &#123;

    items: MenuItem[];

    ngOnInit() &#123;
        this.items = [
            &#123;
               label:'File',
               icon:'pi pi-fw pi-file',
               items:[
                  &#123;
                     label:'New',
                     icon:'pi pi-fw pi-plus',
                     items:[
                        &#123;
                           label:'Bookmark',
                           icon:'pi pi-fw pi-bookmark'
                        &#125;,
                        &#123;
                           label:'Video',
                           icon:'pi pi-fw pi-video'
                        &#125;,

                     ]
                  &#125;,
                  &#123;
                     label:'Delete',
                     icon:'pi pi-fw pi-trash'
                  &#125;,
                  &#123;
                     separator:true
                  &#125;,
                  &#123;
                     label:'Export',
                     icon:'pi pi-fw pi-external-link'
                  &#125;
               ]
            &#125;,
            &#123;
               label:'Edit',
               icon:'pi pi-fw pi-pencil',
               items:[
                  &#123;
                     label:'Left',
                     icon:'pi pi-fw pi-align-left'
                  &#125;,
                  &#123;
                     label:'Right',
                     icon:'pi pi-fw pi-align-right'
                  &#125;,
                  &#123;
                     label:'Center',
                     icon:'pi pi-fw pi-align-center'
                  &#125;,
                  &#123;
                     label:'Justify',
                     icon:'pi pi-fw pi-align-justify'
                  &#125;,

               ]
            &#125;,
            &#123;
               label:'Users',
               icon:'pi pi-fw pi-user',
               items:[
                  &#123;
                     label:'New',
                     icon:'pi pi-fw pi-user-plus',

                  &#125;,
                  &#123;
                     label:'Delete',
                     icon:'pi pi-fw pi-user-minus',

                  &#125;,
                  &#123;
                     label:'Search',
                     icon:'pi pi-fw pi-users',
                     items:[
                        &#123;
                           label:'Filter',
                           icon:'pi pi-fw pi-filter',
                           items:[
                              &#123;
                                 label:'Print',
                                 icon:'pi pi-fw pi-print'
                              &#125;
                           ]
                        &#125;,
                        &#123;
                           icon:'pi pi-fw pi-bars',
                           label:'List'
                        &#125;
                     ]
                  &#125;
               ]
            &#125;,
            &#123;
               label:'Events',
               icon:'pi pi-fw pi-calendar',
               items:[
                  &#123;
                     label:'Edit',
                     icon:'pi pi-fw pi-pencil',
                     items:[
                        &#123;
                           label:'Save',
                           icon:'pi pi-fw pi-calendar-plus'
                        &#125;,
                        &#123;
                           label:'Delete',
                           icon:'pi pi-fw pi-calendar-minus'
                        &#125;,

                     ]
                  &#125;,
                  &#123;
                     label:'Archieve',
                     icon:'pi pi-fw pi-calendar-times',
                     items:[
                        &#123;
                           label:'Remove',
                           icon:'pi pi-fw pi-calendar-minus'
                        &#125;
                     ]
                  &#125;
               ]
            &#125;,
            &#123;
               separator:true
            &#125;,
            &#123;
               label:'Quit',
               icon:'pi pi-fw pi-power-off'
            &#125;
        ];
    &#125;
&#125;
</app-code>
        </p-tabPanel>
        <p-tabPanel header="StackBlitz">
            <ng-template pTemplate="content">
                <iframe src="https://stackblitz.com/edit/primeng-slidemenu-demo?embed=1" style="width: 100%; height: 768px; border: none;"></iframe>
            </ng-template>
        </p-tabPanel>
    </p-tabView>
</div>